package cn.edu.sgu.www.mhxysy.controller.xingshi;

import cn.edu.sgu.www.mhxysy.consts.CustomConstants;
import cn.edu.sgu.www.mhxysy.consts.CustomMessages;
import cn.edu.sgu.www.mhxysy.consts.MimeTypes;
import cn.edu.sgu.www.mhxysy.entity.xingshi.XingshiXianghunCategory;
import cn.edu.sgu.www.mhxysy.restful.JsonResult;
import cn.edu.sgu.www.mhxysy.service.xingshi.XingshiXianghunService;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotBlank;

/**
 * @author 沐雨橙风ιε
 * @version 1.0
 */
@Api(tags = "星石相魂属性管理")
@ApiSupport(author = CustomConstants.AUTHOR)
@Validated
@RestController
@RequestMapping(path = "/xingshi_xianghun", produces = MimeTypes.APPLICATION_JSON_CHARSET_UTF_8)
public class XingshiXianghunController {

    private final XingshiXianghunService xingshiXianghunService;

    @Autowired
    public XingshiXianghunController(XingshiXianghunService xingshiXianghunService) {
        this.xingshiXianghunService = xingshiXianghunService;
    }

    @ApiOperation("查询星石的相魂属性")
    @RequestMapping(value = "/selectByXingshiId", method = RequestMethod.GET)
    public JsonResult<XingshiXianghunCategory> selectByXingshiId(
            @ApiParam(name = "xingshiId", value = "星石ID", required = true)
            @NotBlank(message = CustomMessages.XINGSHI_ID_NOT_NULL) String xingshiId) {
        XingshiXianghunCategory xingshiXianghunCategory = xingshiXianghunService.selectByXingshiId(xingshiId);

        return JsonResult.success(null, xingshiXianghunCategory);
    }

}